//
//  ManageCellTableViewCell.m
//  MY Project For Sport
//
//  Created by admin on 16/2/11.
//  Copyright © 2016年 dilo. All rights reserved.
//

#import "ManageCellTableViewCell.h"
#import <SDWebImage/UIImageView+WebCache.h>
#import "ModelForMatch.h"
#import "DataBaseHandle.h"
#import <DKNightVersion.h>

#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height

#define WEIGHTT [UIScreen mainScreen].bounds.size.width / 375
#define HEIGHTT [UIScreen mainScreen].bounds.size.height / 667


@interface ManageCellTableViewCell ()

@property (nonatomic, retain)UIImageView *teamImage;

@property (nonatomic, retain)ModelForMatch *model;


@end


@implementation ManageCellTableViewCell

- (void)dealloc {
    
    [_teamImage release];
    [_labelForTitle release];
    [_button release];
    [_model release];
    
    [super dealloc];

}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {

    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        self.contentView.dk_backgroundColorPicker = DKColorWithRGB(0xffffff, 0x343434);

        [self createSubView];
        
    }


    return self;


}

- (void)createSubView {
    

    self.teamImage = [[UIImageView alloc] init];
    [self.contentView addSubview:self.teamImage];
    [_teamImage release];
    
    
    self.labelForTitle = [[UILabel alloc] init];
    [self.contentView addSubview:self.labelForTitle];
    [_labelForTitle release];
    
    
    self.button = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.contentView addSubview:self.button];


}

- (void)layoutSubviews {

    [super layoutSubviews];

    self.teamImage.frame = CGRectMake(10 * WEIGHTT, 10 * HEIGHTT, WIDTH / 8, HEIGHT - 20 * HEIGHTT);
  //  self.teamImage.backgroundColor = [UIColor orangeColor];

    
    self.labelForTitle.frame = CGRectMake(20 * WEIGHTT + WIDTH / 8 , 10 * HEIGHTT, WIDTH / 4, HEIGHT - 20 * HEIGHTT);
    self.labelForTitle.dk_textColorPicker = DKColorWithColors([UIColor blackColor], [UIColor whiteColor]);
   // self.labelForTitle.backgroundColor = [UIColor redColor];

    self.button.frame = CGRectMake(WIDTH - 60 * WEIGHTT, 10 * HEIGHTT, 40 * WEIGHTT, HEIGHT - 20 * HEIGHTT);
  // self.button.backgroundColor = [UIColor yellowColor];
    
    
}


- (void)passModelForManage:(ModelForMatch *)model {

   
        [self.teamImage sd_setImageWithURL:[NSURL URLWithString:model.logo]];
        
        self.labelForTitle.text = model.title;
        [self.button setImage:[UIImage imageNamed:@"iconfont-youjiantou"] forState:UIControlStateNormal];
        
        self.button.userInteractionEnabled = NO;
    


}





- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
